package com.itheima.作业.第三题;

//父类: 动物类
public abstract class Animal {
    //属性：年龄，颜色
    private int age;
    private String color;

    public Animal() {
    }

    public Animal(int age, String color) {
        this.age = age;
        this.color = color;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    //eat(String something)方法(无具体行为)
    public abstract void eat(String something);
}

class Dog extends Animal{

    public Dog() {
    }

    public Dog(int age, String color) {
        super(age, color);
    }

    //看家lookHome方法(无参数)
    public void lookHome(){
        System.out.println("看家");
    }

    @Override
    public void eat(String something) {
        System.out.println(super.getAge()+"岁的"+super.getColor()+"的狗两只前腿死死的抱住"+something+"猛吃");
    }
}

class Cat extends Animal{

    public Cat() {
    }

    public Cat(int age, String color) {
        super(age, color);
    }

    //逮老鼠catchMouse方法(无参数)
    public void catchMouse(){

    }

    @Override
    public void eat(String something) {
        System.out.println(super.getAge()+"岁的"+super.getColor()+"的猫眯着眼睛侧着头吃"+something);
    }
}

//定义Person类
class Person{
    //属性：（姓名，年龄）
    private String name;
    private int age;

    //行为：keepPet( ????? ,String something)方法
    public void keepPe(Animal animal ,String something){
        System.out.println("年龄为"+this.age+"岁的"+this.name+"养了一只"+animal.getColor()+"的"+animal.getAge()+"岁的宠物");
        //指挥动物吃东西
        animal.eat(something);
    }
    //生成空参有参构造，set和get方法
    public Person() {
    }

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}
